package cc.deng.wubo.minapp.beans;

import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * Created by Administrator on 2018/3/16.
 */
@Table("t_role")
public class SysRole  implements Serializable {
    @Column
    @Comment("编号")
    @Id
    @Prev({
            @SQL(db= DB.MYSQL,value = "SELECT IFNULL(MAX(id),0)+1 FROM t_role"),
            @SQL(db= DB.ORACLE,value = "SELECT COALESCE(MAX(id),0)+1 FROM t_role")
    })
    private Integer id;


    @Column
    @Comment("角色名称")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String name;


    @Column
    @Comment("备注")
    @ColDefine(type = ColType.VARCHAR, width = 1000)
    private String remarks;


    @ManyMany(from = "role_id", relation = "t_user_role", to = "user_id")
    private List<SysUser> users;
    @ManyMany(from = "role_id", relation = "t_role_menu", to = "menu_id")
    private List<SysMenu> menus;

    private String menuList;

    public String getMenuList() {
        return menuList;
    }

    public void setMenuList(String menuList) {
        this.menuList = menuList;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public List<SysUser> getUsers() {
        return users;
    }

    public void setUsers(List<SysUser> users) {
        this.users = users;
    }

    public List<SysMenu> getMenus() {
        return menus;
    }

    public void setMenus(List<SysMenu> menus) {
        this.menus = menus;
    }

    @Override
    public String toString() {
        return "SysRole{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", remarks='" + remarks + '\'' +
                ", users=" + users +
                ", menus=" + menus +
                '}';
    }
}
